#!/bin/bash

# 安装zsh-autosuggestions
# https://github.com/zsh-users/zsh-autosuggestions
git clone git://github.com/zsh-users/zsh-autosuggestions $ZSH_CUSTOM/plugins/zsh-autosuggestions

# 设置.zshrc
tee -a $HOME/.zshrc > /dev/null << 'EOF'

# some personal alias
alias pbcopy="xsel --clipboard --input"
alias pbpaste="xsel --clipboard --output"
alias scpgamenew="make game; scp -P 2022 -C bin/rogame root@123.59.41.83:~/rogame-new; rm bin/rogame"
alias scpcenternew="make center; scp -P 2022 -C bin/rocenter root@123.59.41.83:~/rocenter-new; rm bin/rocenter"
alias scpgatenew="make gate; scp -P 2022 -C bin/rogate root@123.59.41.83:~/rogate-new; rm bin/rogate"
alias ll="ls -alh"
alias em="/usr/bin/env LC_CTYPE=zh_CN.UTF-8 /usr/bin/emacs -nw"
alias cdro="cd /home/tengyft/Projects/GoProjects/roserver"
alias scpgame="make; scp -P 2022 -C bin/rogame root@123.59.41.83:~/rogame; rm bin/rogame"
alias scpcenter="make; scp -P 2022 -C bin/rocenter root@123.59.41.83:~/rocenter; rm bin/rocenter"
alias scpgate="make; scp -P 2022 -C bin/rogate root@123.59.41.83:~/rogate; rm bin/rogate"
alias sshro="ssh -p 2022 root@123.59.41.83"
alias diff="diff --color=auto"

# colored less
export LESS=-R
export LESS_TERMCAP_mb=$'\E[1;31m'     # begin bold
export LESS_TERMCAP_md=$'\E[1;36m'     # begin blink
export LESS_TERMCAP_me=$'\E[0m'        # reset bold/blink
export LESS_TERMCAP_so=$'\E[01;44;33m' # begin reverse video
export LESS_TERMCAP_se=$'\E[0m'        # reset reverse video
export LESS_TERMCAP_us=$'\E[1;32m'     # begin underline
export LESS_TERMCAP_ue=$'\E[0m'        # reset underline
# and so on

# colored man
man() {
    LESS_TERMCAP_md=$'\e[01;31m' \
    LESS_TERMCAP_me=$'\e[0m' \
    LESS_TERMCAP_se=$'\e[0m' \
    LESS_TERMCAP_so=$'\e[01;44;33m' \
    LESS_TERMCAP_ue=$'\e[0m' \
    LESS_TERMCAP_us=$'\e[01;32m' \
    command man "$@"
}
EOF

# go tool
go get -u -v github.com/nsf/gocode
go get -u -v github.com/rogpeppe/godef
go get -u -v github.com/zmb3/gogetdoc
go get -u -v github.com/golang/lint/golint
go get -u -v github.com/ramya-rao-a/go-outline
go get -u -v sourcegraph.com/sqs/goreturns
go get -u -v golang.org/x/tools/cmd/gorename
go get -u -v github.com/tpng/gopkgs
go get -u -v github.com/acroca/go-symbols
go get -u -v golang.org/x/tools/cmd/guru
go get -u -v github.com/cweill/gotests/...
go get -u -v golang.org/x/tools/cmd/godoc
go get -u -v github.com/fatih/gomodifytags
go get -u -v github.com/josharian/impl
go get -u -v github.com/alecthomas/gometalinter
go get -u -v github.com/derekparker/delve/cmd/dlv
go get -u -v golang.org/x/tools/cmd/goimports
go get -u -v github.com/godoctor/godoctor
